<template>
<div class="no-print">
  <a-card class="info" title="应聘登记表">
      <template slot="extra">
        <a-button
            class="ruleButton"
            :ghost="true"
            type="primary"
            icon="edit"
            @click="handleEdit(model)"
            :disabled="isDisabledAuth('erpHrApplyRegisterBill:edit')"
        />
      </template>
     <a-row type="flex"  justify="center">
       <a-col :span="24">
          <erp-hr-apply-register-bill-form ref="realForm"   :disabled="true" normal></erp-hr-apply-register-bill-form>
       </a-col>
       <a-col :span="24">
          <erp-hr-apply-result-info-form ref="resultForm"  :disabled="true" normal></erp-hr-apply-result-info-form>
       </a-col>
     </a-row>
     <erp-hr-apply-register-bill-modal ref="modalForm" @ok="modalFormOk"></erp-hr-apply-register-bill-modal>
  </a-card>
  <div style="text-align: center;margin-top: 15px;">
    <a-button @click="onPrint" type="primary">打印</a-button>
  </div>

  <ErpHrApplyRegisterBillFormPrint class="print_style" id="printContent" v-show="isPrint" :formData="model"></ErpHrApplyRegisterBillFormPrint>
</div>
</template>

<script>

  import { getAction } from '@/api/manage'
  import {JeecgListMixin} from '@/mixins/JeecgListMixin'
  import ErpHrApplyRegisterBillForm from './modules/ErpHrApplyRegisterBillForm'
  import ErpHrApplyRegisterBillModal from './modules/ErpHrApplyRegisterBillModal'
  import ErpHrApplyQualificationsInfoList from './ErpHrApplyQualificationsInfoList.vue'
  import ErpHrApplyContactInfoList from './ErpHrApplyContactInfoList.vue'
  import ErpHrApplyFamilySocialInfoList from './ErpHrApplyFamilySocialInfoList.vue'
  import ErpHrApplyWorkHistoryList from './ErpHrApplyWorkHistoryList.vue'
  import ErpHrApplyEducationList from './ErpHrApplyEducationList.vue'
  import ErpHrApplyTrainingList from './ErpHrApplyTrainingList.vue'
  import ErpHrApplyRewardPunishFileList from './ErpHrApplyRewardPunishFileList.vue'
  import ErpHrApplyOtherInfoList from './ErpHrApplyOtherInfoList.vue'
  import {DisabledAuthFilterMixin} from '@/mixins/DisabledAuthFilterMixin'
  import ErpHrApplyResultInfoForm from './modules/ErpHrApplyResultInfoForm'
  import ErpHrApplyRegisterBillFormPrint from './modules/ErpHrApplyRegisterBillFormPrint' // 打印组件
  import Print from '@/utils/print/printarea.js';

  export default {
    name: 'ErpHrApplyRegisterBillDetail',
    mixins: [JeecgListMixin, DisabledAuthFilterMixin],
    components: {
      ErpHrApplyResultInfoForm,
     ErpHrApplyRegisterBillForm,
     ErpHrApplyRegisterBillModal,
      ErpHrApplyQualificationsInfoList,
      ErpHrApplyContactInfoList,
      ErpHrApplyFamilySocialInfoList,
      ErpHrApplyWorkHistoryList,
      ErpHrApplyEducationList,
      ErpHrApplyTrainingList,
      ErpHrApplyRewardPunishFileList,
      ErpHrApplyOtherInfoList,
      ErpHrApplyRegisterBillFormPrint
    },
    data () {
      return {
        model: {},
        resultModel:{},
        id: '',
        url: {
          queryById: "/api/erp/hr/apply/erpHrApplyRegisterBill/queryById",
          delete: "/api/erp/hr/apply/erpHrApplyRegisterBill/delete",
          queryByBillId:"/api/erp/hr/apply/erpHrApplyResultInfo/queryByBillId"
        },
        confirmLoading: false,
        iconStyle:{"font-size":"20px"},
        isPrint: false,
      }
    },
    created() {
    },
    watch: {
      $route(to, from) {
        this.loadData();
      },
    },
    mounted() {
    },
    methods: {
      loadData() {
        const id = this.$route.params.id;
        getAction(this.url.queryById, { id }).then((res) => {
          if (res.success) {
            const model = res.result
            this.$refs.realForm.edit(model);
            this.$refs.resultForm.edit(model.applyResultInfo,4);
            this.model=model;
          }
        })
      },
      // 点击打印
      onPrint () {
        this.isPrint = true
        var _this = this
        this.$nextTick(() => {
          let print = new Print({
            el: '#printContent',
            popTitle: '面试管理详情 · 禾美协同办公',
            endCallback() {
              _this.isPrint = false
            }
          })
        })
      }
    }
  }
</script>
<style lang="less" scoped>
@import '~@assets/less/common.less';

.info {
  /deep/ .ant-card-head-title{
    flex: none;
    margin-right: 20px;
  }
  /deep/ .ant-card-extra{
    flex: 1;
    float: left;
  }
}
// .print_style{
//   position: absolute;
//   top: 0;
//   z-index: -1;
// }
</style>
